""""
我的订单page
"""
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from page.base_page import BasePage
class UserOrder(BasePage):
    # def __init__(self,driver):
    #     self.driver=driver
    to_order_locator=(By.NAME,"to_order")
    from_order_locator = (By.NAME, "from_order")
    submit_merge_locator = (By.XPATH,"/html/body/div[8]/div[2]/div/div/div/form[2]/table/tbody/tr[1]/td[5]/input[2]")
    order_time_locator=(By.XPATH,"/html/body/div[8]/div[2]/div/div/div/table/tbody/tr[2]/td[2]")
    def toorder(self):
        to_order_element = self.driver.find_element(*self.to_order_locator)
        select = Select(to_order_element)
        select.select_by_visible_text("2022052446275")
    def fromorder(self):
        from_order_element = self.driver.find_element(*self.from_order_locator)
        select = Select(from_order_element)
        select.select_by_visible_text("2022052435907")
    def sumitmerge(self):
        self.driver.find_element(*self.submit_merge_locator).click()
    def switchalert(self):
        self.driver.switch_to.alert.accept()
    #断言使用toorder
    def ordertime(self):
        time_element = self.driver.find_element(*self.order_time_locator).text
        return time_element